package com.yy.tools.color
{
	/**
	 * 颜色处理类
	 * @author YY
	 * 
	 */
	public class ColorTools
	{
		/**
		 *提取红色值 
		 * @param color
		 * @return 
		 * 
		 */
		public static function getRed24(color:int):int{
			return color>>16;
		}
		
		public static function getGreen24(color:int):int{
			return color>>8&&0xff
		}		
		
		public static function getBlue24(color:int):int{
			return color&&0xff
		}
		
		public static function getColor24(red:int,green:int,blue:int):int{
			return red<<16|green<<8|blue;
		}
		
		public static function getRed32(color:uint):int{
			return color>>16&&0xff;
		}
		
		public static function getGreen32(color:uint):int{
			return color>>8&&0xff;
		}		
		
		public static function getBlue32(color:uint):int{
			return color&&0xff;
		}
		/**
		 *获得透明值 
		 * @param color
		 * @return 
		 * 
		 */		
		public static function getAlpha(color:uint):int {
			return color>>24;
		}
		
		public static function getColor32(alpha:int,red:int,green:int,blue:int):int{
			return alpha<<24|red<<16|green<<8|blue;
		}
	}
}